#ifndef TOTAL_H
#define TOTAL_H

#include <QMainWindow>
#include <QSerialPort>
#include <QTcpServer>
#include <QTcpSocket>
#include <QHostAddress>
#include "mainwindow.h"
#include "message.h"
#include "beep.h"

class MainWindow;       //解决循环包含问题
class Message;

namespace Ui {
class Total;
}

class Total : public QMainWindow
{
    Q_OBJECT

public:
    explicit Total(MainWindow *mainWindow, QWidget *parent = nullptr);
    void Total_init();
    void Serial_init();
    int countNum(int num[]);
    int countPrice(int num[],int price[]);
    void sendData();
    void tcpsendData();
    QSerialPort *serialport;
    ~Total();

private slots:
    void pushButton_pressed();
    void pushButton_2_pressed();
    void pushButton_3_clicked();
    void pushButton_4_clicked();
    void reciveMessages();
    void mstateChanged(QAbstractSocket::SocketState state);

private:
    Ui::Total *ui;
    MainWindow *mainwindow;
    Message *message;
    Beep *beep;
    QTcpSocket *tcpsocket;
};

#endif // TOTAL_H
